<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('计划列表')"/>
    <style>
        .fixed-table-toolbar {
            display: none;
        }
    </style>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <input type="hidden" name="params[ancestors]" th:value="${ancestors}"/>
                        <input type="hidden" name="status" th:value="${status}"/>
                        <input  name="planType" value="1" type="hidden">

                        <li>
                            作物名称：<input type="text" name="cropNameCn"/>
                        </li>
                        <li>
                            作物品种：<input type="text" name="cropVarietiesCn"/>
                        </li>

                        <li class="select-time">
                            <label>计划时间： </label>
                            <input type="text" class="time-input" th:value="${beginTime}" id="startTime"
                                   placeholder="开始时间"
                                   name="params[beginTime]"/>
                            <span>-</span>
                            <input type="text" class="time-input" th:value="${endTime}" id="endTime" placeholder="结束时间"
                                   name="params[endTime]"/>
                        </li>

                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">

            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:ncPlan:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" data-mobile-responsive="true"></table>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:src="@{/ruoyi/js/my-common-js.js}"></script>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:ncPlan:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:ncPlan:remove')}]];
    var prefix = ctx + "system/ncPlan";

    var landType = [[${@dict.getType('landType')}]];
    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "计划",
            showExport: true,
            columns: [{
                checkbox: true
            },
                {
                    field: 'planId',
                    title: '计划id',
                    visible: false
                },
                {
                    field: 'planCode',
                    title: '计划编号',
                    sortable: true
                },
                {
                    field: 'cropNameCn',
                    title: '作物名称',
                    sortable: true
                },
                {
                    field: 'cropVarietiesCn',
                    title: '作物品种',
                    sortable: true
                },
                {
                    field: 'planTime',
                    title: '育苗时间',
                    sortable: true,
                    formatter: function (value, row, index) {
                        return dateFtt(value);
                    }

                },
                {
                    field: 'teamCn',
                    title: '生产班组',
                    sortable: true
                },
                {
                    field: 'chaci',
                    title: '茬次',
                    sortable: true
                },
                {
                    field: 'count',
                    title: '数量(株)',
                    sortable: true
                },
                {
                    field: 'plateCount',
                    title: '盘数',
                    sortable: true
                },
                {
                    field: 'cycleDays',
                    title: '循环天数',
                    sortable: true
                },
                {
                    field: 'area',
                    title: '单茬面积(亩)',
                    sortable: true
                },
                {
                    field: 'jian',
                    title: '间数',
                    sortable: true
                },
                {
                    field: 'createTime',
                    title: '计划制定时间',
                    sortable: true,
                    visible: false
                },
                {
                    field: 'createBy',
                    title: '计划制定人',
                    sortable: true
                },
                {
                    field: 'standard.standardName',
                    title: '标准名称',

                },
                {
                    field: 'remark',
                    title: '备注',
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value);
                    }
                },{
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="planDetail(\'' + row.planId + '\')"><i class="fa fa-info"></i>详情</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    /*function planDetail(planId) {
        var link = ctx + 'system/front_wenshi/planDetail?planId=' + planId+"&planType=2";
        $.modal.openTab('计划详情', link);
    }*/

    /*查看详情*/
    function planDetail(planId) {
        var link = ctx + 'system/ncPlan/planDetail?planId=' + planId + "&planType=1";
        $.modal.openTab('计划详情', link);
    }
    setTitle("育苗计划",false)
</script>
</body>
</html>